package cn.com.cdb.ldms.filter.sensitive;

import ch.qos.logback.classic.pattern.MessageConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

@Slf4j
public class SensitiveDataConverter extends MessageConverter {
    public static final Map<String, String> rules = Maps.newConcurrentMap();

    @Override
    public String convert(ILoggingEvent event) {
        String message = super.convert(event);
        // 执行脱敏处理
        return SensitiveDataUtils.desensitize(message, rules);
    }
}